package com.ws.common.easyui.util;

import cn.hutool.core.util.StrUtil;
import com.ws.common.util.StringUtils;

public class Page {

    private Integer page;

    private Integer rows;

    private String order;

    private  String sort;

    public Integer getPage() {
        if(page==null){
            return 1;
        }
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getRows() {
        if(rows==null){
            return Integer.MAX_VALUE-1000;
        }
        return rows;
    }

    public void setRows(Integer rows) {
        this.rows = rows;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getSortOrder(){
        if (StrUtil.isEmpty(this.sort) || StrUtil.isEmpty(this.order)){
            return null;
        }

        return StringUtils.camelToUnderline(this.sort)+" "+this.order;
    }
}
